package com.atguigu.day17.list03;

import org.junit.Before;
import org.junit.Test;

import java.util.Iterator;
import java.util.List;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/20 15:15
 * @注释
 */
public class ListForTest {
    List<String> list;
    @Before
    public void before(){
        list = List.of("张三","赵四","王五","赵六","陈一","黄二");
    }
    @Test
    public void test01(){
        for (String s : list) {
            System.out.println("s = " + s);
        }
    }
    @Test
    public void test02(){
        Iterator<String> iterator = list.iterator();
        while(iterator.hasNext()){
            String next = iterator.next();
            System.out.println("next = " + next);
        }
    }
    @Test
    public void test03(){
        for (int i = 0; i < list.size(); i++) {
            System.out.println("普通for:" + list.get(i));
        }
    }
    @Test
    public void test04(){

    }
}
